﻿var cityID;
var category;
var testID;
var markArr = 'A&B&C&D&E';
var tr1;
var ulMessage = "";
var initlat = "";
var initlng = "";
var getJsonNum = "";
var page = "";
var ticket = "0";
var getJsonNumSum = '';
var initTabName = "";
var tabCategoryID = "";
var testTrademarkTab = "";

//记录5个商户的经纬度
var shopLat1 = "";
var shopLat2 = "";
var shopLat3 = "";
var shopLat4 = "";
var shopLat5 = "";

var shopLng1 = "";
var shopLng2 = "";
var shopLng3 = "";
var shopLng4 = "";
var shopLng5 = "";

function initCity() {

    //根据URL来得到CITYID
    var locationUrl = window.location.href;
    var CityID = locationUrl.split('/');
    var ID = CityID[CityID.length - 1];

    if (ID.split('#').length > 1) {
        var s = ID.split('#');
        ID = s[0];
        //得到此处的CATEGORYID
        tabCategoryID = s[1].split('-');
        //根据具体的CATEGORYID给标签ID为categoryID的标签赋值
        if (tabCategoryID[1] == '1') {
            document.getElementById("categoryID").value = '1';
        }
        if (tabCategoryID[1] == '2') {
            document.getElementById("categoryID").value = '3';
        }
        if (tabCategoryID[1] == '3') {
            document.getElementById("categoryID").value = '2';
        }
        if (tabCategoryID[1] == '5') {
            document.getElementById("categoryID").value = '4';
        }
    }


    //给标签ID为cityID的标签赋值
    document.getElementById("cityID").value = ID;
    var CategoryID = document.getElementById("categoryID").value;

    cityID = ID;

    //判断是否标签ID为categoryID的是否有值,没有的话就赋给category初始值
    if ((document.getElementById("categoryID").value == "" || document.getElementById("categoryID").value == null) && (CategoryID == "" || CategoryID == null)) {
        category = 3;
    } else {
        category = CategoryID;
    }
    //把得到的最终的CATEGORY赋给标签
    document.getElementById("categoryID").value = category;


    //初始化第一个TAB项目
    getRightCloumn(ID);


    //给标签ID为checkPageNum赋初始值
    document.getElementById("checkPageNum").value = 'init';

//    document.getElementById("changeButton").style["visibility"] = 'hidden';
//    document.getElementById("container-1").style["visibility"] = 'hidden';
//    document.getElementById("container-2").style["visibility"] = 'hidden';
//    document.getElementById("div_wait").style["visibility"] = 'visible';
    //调用此方法来得到城市初始化经纬度
    getCityInitLatLng(cityID)
    //加载此方法来实现TAB的转换
    changeTab();
    //调用此方法来显示城市天气信息
    getCityWeather(ID);
    //调用此方法来显示城市信息
    getCityMessage(ID);
    //changeaddli(ulMessage);
    //加载此方法来保证以后点击功能的实现
    ClickMenu001(ID);
    //加载此方法来保证以后点击功能的实现
    ClickMenu002(ID);
    //加载此方法来保证以后点击功能的实现
    ClickMenu003(ID);
    //ClickMenu004();
    //加载此方法来保证以后点击功能的实现
    ClickMenu005(ID);
    // ClickMenu006();
    //加载此方法来保证以后点击功能的实现
    ClickMenu007(ID);
//    document.getElementById("changeButton").style["visibility"] = 'visible';
//    document.getElementById("container-1").style["visibility"] = 'visible';
//    document.getElementById("container-2").style["visibility"] = 'visible';
//    document.getElementById("div_wait").style["visibility"] = 'hidden';
    //getOtherTab();
    // }
    //加载此方法来完成对页面效果的实现
    $(function() {
        $('#links tr').biggerlink();
        $('#junketinglinks tr').biggerlink();
        $('#dieteticlinks tr').biggerlink();
        $('#quarterlinks tr').biggerlink();
        $('#container-1').tabs({ fxFade: true, fxSpeed: 'fast' });
        $('#container-2').tabs({ fxFade: true, fxSpeed: 'fast' });
        $('a.morecity').cluetip({ width: '200px' })
    })

}

//初始化页面右边TAB的数据
function getRightCloumn(ID) {
    
    document.getElementById("pageID").value = '1';
    category = document.getElementById("categoryID").value;
    //DIV中用到的JSON

    $.getJSON('/City/RightColumnInterface/' + ID + ',1,' + category, { t: new Date() }, function(j) {
        //程序开始的一些初始化变量
        
        var arrmark = markArr.split('&');
        var arr = new Array();
        var arr1 = new Array();
        var arr2 = new Array();
        var s = null;
        //对从后台出来的数据进行分割,然后把经纬度赋给变量
        arr1 = j[0].split('|');
        arr2 = arr1[1].split(',');
        initlat = arr2[0];
        initlng = arr2[1];
        var sumNum = "";
        var tableTabName = '';
        //当后台数据出来不为'nonintmessage'的时候,也就是不为空的时候进行数据的加载
        if (arr1[0] != "nonintmessage") {
            if (j.length < 5) {
                sumNum = j.length;
            } else {
                sumNum = 5;
            }
            //对查询出来的数据进行循环便利
            for (var i = 0; i < sumNum; i++) {

                var value = j[i];

                //分割开查询出的数据来得到我们想要的各个值
                arr = value.split('|');
                if (arr.length < 2) {
                    break;
                }
                //得到商户名称
                var shopName = arr[0];
                //得到商户ID
                var shopID = arr[1];
                //得到商户的LOGO的名字
                var shopLogoUrl = arr[2];
                //得到商户的具体信息
                var shopMessage = arr[3];
                //得到城市ID
                var cityID = arr[4];
                //得到经纬度
                var lat = arr[5];
                var lng = arr[6];
                //通过分割和赋值来最终确定商户LOGO的加载路径
                if (shopLogoUrl == "" || shopLogoUrl == null) {
                    shopLogoUrl = '/Content/img/home/iniImg.bmp';
                }
                //来对商户的信息进行具体的字数分割
                var message = "";
                if (i == 0) {
                    //因为第一条商户是推荐商户,所以字数也稍微多点
                    message = shopMessage.substring(0, 68);
                }
                else {
                    //后面的商户不为推荐商户,字数少点
                    message = shopMessage.substring(0, 29);
                }
                //以下根据不同的CATEGORYID来对不同的TAB下的TABLE赋值
                //当CATEGORYID=1的时候来对第一个TAB下的TABLE里的标签赋值
                if (document.getElementById("categoryID").value == '3') {
                   // alert('test01');
                    $("#index" + (i + 1)).html("标签:" + arrmark[i]);
                    $("#shopName" + (i + 1)).html(shopName);
                    $("#messageShop" + (i + 1)).html(message + '...');
                    $("#Shop" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#shopLogoImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#ParticularMessage" + (i + 1)).html(">>>>>>详细信息");
                    $("#Shop" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#firstShop" + (i + 1)).attr("href", '/City/Trademark/' + shopID);

                    //控制TAB上的数据显示
                    //document.getElementById("links").style["visibility"] = "visible";
                    document.getElementById("ParticularMessage" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("Shop" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("firstShop" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("shopLogoImg" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("messageShop" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("index" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("shopName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("ParticularMessage" + (i + 1)).style["visibility"] = "visible";
                    //设定TABLENAME,为下面加载数据做准备
                    tableTabName = 'shop_tb';


                    //当CATEGORYID=3的时候来对第一个TAB下的TABLE里的标签赋值
                } else if (document.getElementById("categoryID").value == '4') {

                    $("#junketingName" + (i + 1)).html(shopName);
                    $("#junketingMessage" + (i + 1)).html(message + '...');
                    $("#junketing" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#junketing" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#firstJunketing" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#junketingImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#junketingParticularMessage" + (i + 1)).html('>>>>>>详细信息');
                    // document.getElementById("junketingMessage" + (i + 1)).innerText = message + '...';
                    //document.getElementById("junketing" + (i + 1)).title = shopName + "欢迎您";
                    //document.getElementById("junketing" + (i + 1)).href = '/City/Trademark/' + shopID;
                    //document.getElementById("firstJunketing" + (i + 1)).href = '/City/Trademark/' + shopID;
                    //document.getElementById("junketingImg" + (i + 1)).src = shopLogoUrl;

                    //控制TAB上的数据显示
                    document.getElementById("junketingMessage" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("junketing" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("firstJunketing" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("junketingImg" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("lb_junketing" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("junketingName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("junketingParticularMessage" + (i + 1)).style["visibility"] = "visible";
                    //设定TABLENAME,为下面加载数据做准备
                    tableTabName = 'pageNum_tb';
                    //当CATEGORYID=2的时候来对第一个TAB下的TABLE里的标签赋值
                } else if (document.getElementById("categoryID").value == '1') {
                    $("#dieteticName" + (i + 1)).html(shopName);
                    $("#dieteticMessage" + (i + 1)).html(message + '...');
                    $("#dietetic" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#dietetic" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#FirstDietetic" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#dieteticImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#dieteticParticularMessage" + (i + 1)).html('>>>>>>详细信息');
                    //                    document.getElementById("dieteticMessage" + (i + 1)).innerText = message + '...';
                    //                    document.getElementById("dietetic" + (i + 1)).title = shopName + "欢迎您";
                    //                    document.getElementById("dietetic" + (i + 1)).href = '/City/Trademark/' + shopID;
                    //                    document.getElementById("FirstDietetic" + (i + 1)).href = '/City/Trademark/' + shopID;
                    //                    document.getElementById("dieteticImg" + (i + 1)).src = shopLogoUrl;


                    //控制TAB上的数据显示
                    document.getElementById("dieteticMessage" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("dietetic" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("FirstDietetic" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("dieteticImg" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("lb_dietetic" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("dieteticName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("dieteticParticularMessage" + (i + 1)).style["visibility"] = "visible";
                    //设定TABLENAME,为下面加载数据做准备
                    tableTabName = 'dietetic_tb';
                    //当CATEGORYID=1的时候来对第一个TAB下的TABLE里的标签赋值
                } else if (document.getElementById("categoryID").value == '2') {
                    $("#quarterName" + (i + 1)).html(shopName);
                    $("#quarterMessage" + (i + 1)).html(message + '...');
                    $("#quarter" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#quarter" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#firstQuarter" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#quarterImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#quarterParticularMessage" + (i + 1)).html('>>>>>>详细信息');
                    //                    document.getElementById("quarterMessage" + (i + 1)).innerText = message + '...';
                    //                    document.getElementById("quarter" + (i + 1)).title = shopName + "欢迎您";
                    //                    document.getElementById("quarter" + (i + 1)).href = '/City/Trademark/' + shopID;
                    //                    document.getElementById("firstQuarter" + (i + 1)).href = '/City/Trademark/' + shopID;
                    //                    document.getElementById("quarterImg" + (i + 1)).src = shopLogoUrl;


                    //控制TAB上的数据显示
                    document.getElementById("quarterMessage1" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("quarter" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("firstQuarter" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("quarterImg" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("lb_quarter" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("quarterName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("quarterParticularMessage" + (i + 1)).style["visibility"] = "visible";
                    //设定TABLENAME,为下面加载数据做准备
                    tableTabName = 'quarter_tb';
                } else {
                    alert('arror test');
                }

                getJsonNum = i;

            }
            //如果查询出的数据不足五条信息的显示
            if (sumNum != 5) {
                //根据具体有多少条记录来记性计算
                var sumNumi = 5 - sumNum;
                //根据循环来对各个标签进行操作
                for (var p = sumNum - 1; p < 5; p++) {
                    //alert('test02');
                    if (document.getElementById("categoryID").value == '3') {
                        document.getElementById("ParticularMessage" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("Shop" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("firstShop" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("shopLogoImg" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("index" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("shopName" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("ParticularMessage" + (p + 1)).style["visibility"] = "hidden";
                    }
                    if (document.getElementById("categoryID").value == '4') {
                        document.getElementById("junketingMessage" + (p + 1)).style["visibility"] = "hidden";
                        //document.getElementById("junketing" + (getJsonNum + 1)).title = shopName + "欢迎您";
                        document.getElementById("junketing" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("firstJunketing" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("junketingImg" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("lb_junketing" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("junketingName" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("junketingParticularMessage" + (p + 1)).style["visibility"] = "hidden";
                    }
                    if (document.getElementById("categoryID").value == '1') {
                        document.getElementById("dieteticMessage" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("dietetic" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("FirstDietetic" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("dieteticImg" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("lb_dietetic" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("dieteticName" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("dieteticParticularMessage" + (p + 1)).style["visibility"] = "hidden";
                    }
                    if (document.getElementById("categoryID").value == '2') {
                        document.getElementById("quarterMessage1" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("quarter" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("firstQuarter" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("quarterImg" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("lb_quarter" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("quarterName" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("quarterParticularMessage" + (p + 1)).style["visibility"] = "hidden";
                    }
                }
            } //IF结束
            document.getElementById("checkPageNum").value = 'init';
            //掉用此方法来得到此TAB的分页
            //alert('initpagenum');
            getPageNum(ID, document.getElementById("categoryID").value, tableTabName);
            //对inittabname进行初始化赋值
            initTabName = 'index';
            //调用此方法来进行MARKER的创建
            getCityMarker();

            //测试第三页的跳转页
            //判断是否为第三页跳转过来的搜索

            if (document.getElementById("testTrademarkSearch").value == 'testOK') {
                //alert('test05');
                if (document.getElementById("TrademarkSearchString").value == "" || document.getElementById("TrademarkSearchString").value == null) {
                    //alert('test06');
                    document.getElementById("testTrademarkSearch").value == 'testNO';
                    clickSerach();
                } else {
                    //alert('test07');
                    document.getElementById("testTrademarkSearch").value == 'testNO';
                    Serach();

                }

            }

            //以下程序是根据不同的CATEGORYID来对不同的TAB赋于默认值
        } else {

            if (document.getElementById("categoryID").value == '3') {
                //alert('test08');
                document.getElementById("links").style["visibility"] = "hidden";

                document.getElementById("hiddenLable1").innerText = "暂无任何信息";
            }
            if (document.getElementById("categoryID").value == '4') {
                //alert('test09');
                document.getElementById("junketinglinks").style["visibility"] = "hidden";
                document.getElementById("hiddenLable").innerText = "暂无任何信息";
            }
            if (document.getElementById("categoryID").value == '1') {
                //alert('test10');
                document.getElementById("dieteticlinks").style["visibility"] = "hidden";
                document.getElementById("hiddenLable2").innerText = "暂无任何信息";
            }
            if (document.getElementById("categoryID").value == '2') {
                //alert('test11');
                document.getElementById("quarterlinks").style["visibility"] = "hidden";
                document.getElementById("hiddenLable4").innerText = "暂无任何信息";
            }


            //当没有任何数据的时候地图加载为默认的城市经纬度
            var locationUrl = window.location.href;
            var arrUrl = locationUrl.split("/");
            var CID = arrUrl[arrUrl.length - 1];
            var CityID = "";
            if (CID.split('#').length != 0) {
                var arrcity = CID.split('#');
                CityID = arrcity[0];
            } else {
                CityID = CID;
            }
            getCityInitLatLng(CityID);

            initMap(initlat, initlng);

            //判断是否为第三页跳转过来的搜索
            if (document.getElementById("testTrademarkSearch").value == 'testOK') {

                if (document.getElementById("TrademarkSearchString").value == "" || document.getElementById("TrademarkSearchString").value == null) {
                    //alert('test');
                    document.getElementById("testTrademarkSearch").value == 'testNO';
                    clickSerach();

                } else {
                    //alert('test');
                    document.getElementById("testTrademarkSearch").value == 'testNO';
                    Serach();


                }

            }

        }

    })
}
//分页程序,根据传入的不同值对不同的TABLE进行分页程序操作
function getPageNum(ID, category, tableTabName) {
   // alert(tableTabName);
    var tabRows = document.getElementById(tableTabName).rows.length;

    var tb = document.getElementById(tableTabName);
    if (tabRows != '0') {
        tb.deleteRow(0);
    }

    //得到一共要分多少页
    var s = "";
    //表格自动生成步骤
   // tr1 = document.getElementById(tableName).insertRow();
    //通过JSON来得到具体的值
//    $.getJSON('/City/RightPageNum/' + ID + "," + category, { t: new Date() }, function(j) {
//        var s = "";
//        //循环得到各值
//        for (var i = 0; i < 1; i++) {
//            var value = j[i];
//            //根据查询出的信息来得到具体分为多少页
//            //s为每页5条信息,一共需要显示多少条记录
//            s = value / 5;
//            //            page = 0;
//            //            var sum = "";
//            //            page = parseInt(s);
//            //            //点击页码以后的前后页显示的调用
//            //            if (s > page) {
//            //                page = page + 1;
//            //            }
//            //            if (page < 6) {
//            //                sum = page;
//            //            } else {
//            //                sum = 6;
//            //            }
//            //            //根据上面的信息来进行循环对页码进行显示
//            //            for (var j = 0; j < sum; j++) {

//            //                var td1 = tr1.insertCell();
//            //                td1.width = "20px";
//            //                $(td1).html("<a href='#' onclick='test(" + (j + 1) + ");' id='pageUrl'" + (j + 1) + " class='link'>" + (j + 1) + "</a>");
//            //                //td1.innerHTML = "<a href='#' onclick='test(" + (j + 1) + ");' id='pageUrl'" + (j + 1) + " class='link'>" + (j + 1) + "</a>";

//            //            }

//        }

    //通过JSON来得到具体的值
    $.getJSON('/City/RightPageNum/' + ID + "," + category, { t: new Date() }, function(j) {
        var cityNum1 = j[0];
        //alert(tableTabName);
        var tg = "#" + tableTabName + ">tbody>tr>td:last";

        tr_id = $(tg).attr("id");

        tr_id++;
        var str1 = "<tr id = '" + tr_id + "'>";
        var str2 = "</tr>";
        var std = "";
        //alert(tr_id);
        //得到一共需要分成几页
        //alert(cityNum1);
        var s = cityNum1 / 5;
        var sum;
        var pagei = 0;
        pagei = parseInt(s);
        page = pagei;
        //点击页码以后的前后页显示的调用
        if (s > pagei) {
            pagei = pagei + 1;
        }
        if (pagei < 6) {
            sum = pagei;
        } else {
            sum = 6;
        }


        //通过循环来把页码显示在页面上
        for (var j = 0; j < sum; j++) {


            std += "<td width='20px'><a href='#' onclick='test(" + (j + 1) + ");' id='pageUrl'" + (j + 1) + " class='link'>" + (j + 1) + "</a></td>";

        }

        var strtd = str1 + std + str2;
        // var shopName = "shop_tb";
        $("#" + tableTabName).append(strtd);

    })
    
    
    
    
  






//        tr_id = $("#shop_tb>tbody>tr>td:last").attr("id");
//        //alert(tr_id);
//        tr_id++;
//        var str1 = "<tr id = '" + tr_id + "'>";
//        var str2 = "</tr>";
//        var std = "";
//        //alert(tr_id);
//        //得到一共需要分成几页
//        var sp = s / 5;
//        var page = 0;
//        page = parseInt(sp);

//        if (sp > page) {
//            page = page + 1;
//        }
//        //通过循环来把页码显示在页面上
//        for (var j = 0; j < page; j++) {


//            std += "<td width='20px'><a href='#' onclick='pageNum(" + (j + 1) + ");' id='pageUrl'" + (j + 1) + " class='link'>" + (j + 1) + "</a></td>";

//        }

//        var strtd = str1 + std + str2;

//        $(tableName).append(strtd);



//    })
}
//当点击箭头按钮的时候进行TAB的转换
function changeTab() {
    $.getJSON('/City/changeOption/' + 0, { t: new Date() }, function(j) {
        var s = null;
        for (var i = 0; i < j.length; i++) {
            s = j[i];
        }
        document.getElementById('container-2').style["visibility"] = "hidden";
    })
}

//当点击第一个TAB的时候调用的方法
function ClickMenu001(ID) {

    $('#Menu001').click(function() {
        //当调用的时候对两个标签赋初始值
        document.getElementById("pageID").value = '1';
        document.getElementById("categoryID").value = '3';
        document.getElementById("checkPageNum").value = 'click';
        //通过JSON来对此出的数据进行查询
        $.getJSON('/City/ClickColumnInterface/3' + "," + ID + ",1", { t: new Date() }, function(j) {
            var arrmark = markArr.split('&');
            var arr = new Array();
            var s = null;
            var sumNum = "";
            //判断查询出的是否有数据
            if (j.length != 0) {
                //通过FOR循环来得到不同的值
                if (j.length < 5) {
                    sumNum = j.length;
                } else {
                    sumNum = 5;
                }
                for (var i = 0; i < sumNum; i++) {
                    //通过分割来得到不同的值
                    var value = j[i];

                    arr = value.split('|');

                    //得到商户名称
                    var shopName = arr[0];
                    //得到商户ID
                    var shopID = arr[1];
                    //得到商户的LOGO
                    var shopLogoUrl = arr[2];
                    //得到商户的信息
                    var shopMessage = arr[3];
                    //通过分割和拼合来得到商户LOGO的具体信息
                    if (shopLogoUrl == "" || shopLogoUrl == null) {
                        shopLogoUrl = '/Content/img/home/iniImg.bmp';
                    }
                    //来对商户信息进行字数分割
                    var message = "";
                    if (i == 0) {
                        message = shopMessage.substring(0, 68);
                    }
                    else {
                        message = shopMessage.substring(0, 29);
                    }
                    //根据具体的信息内容来对各个标签进行赋值
                    $("#index" + (i + 1)).html("标签:" + arrmark[i]);
                    $("#shopName" + (i + 1)).html(shopName);
                    $("#messageShop" + (i + 1)).html(message + '...');
                    $("#Shop" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#shopLogoImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#ParticularMessage" + (i + 1)).html(">>>>>>详细信息");
                    $("#Shop" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#firstShop" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    //控制TAB上的数据显示
                    document.getElementById("ParticularMessage" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("Shop" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("firstShop" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("shopLogoImg" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("index" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("shopName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("ParticularMessage" + (i + 1)).style["visibility"] = "visible";
                    getJsonNum = i + 1;

                } //for结束
                //如果查询出的数据不足五条信息的显示
                if (getJsonNum != 5) {
                    //根据具体有多少条记录来记性计算
                    var getJsonNumi = 5 - getJsonNum;
                    //根据循环来对各个标签进行操作
                    for (var p = getJsonNum; p < 5; p++) {

                        document.getElementById("ParticularMessage" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("Shop" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("firstShop" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("shopLogoImg" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("index" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("shopName" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("ParticularMessage" + (p + 1)).style["visibility"] = "hidden";
                    }
                } //IF结束
                //判断是否为第一次加载的信息
                if (document.getElementById("checkPageNum").value != 'init' && document.getElementById("checkshop").value != "1") {

                    document.getElementById("checkPageNum").value = 'click';
                    document.getElementById("checkshop").value = "1";

                    category = '3';
                    //对此TAB来进行分页程序的操作
                    getPageNum(ID, '3', 'shop_tb');
                } //IF结束
                initTabName = 'index';
                
                //创建MARKER
                getCityMarker();
                document.getElementById("links").style["visibility"] = "visible";
                document.getElementById("hiddenLable1").style["visibility"] = "hidden";
                //如果没有任何信息对TABLE的显示的初始化
            } else {
                document.getElementById("links").style["visibility"] = "hidden";
                document.getElementById("hiddenLable1").innerText = "暂无任何信息";
                //当数据为空的时候对地图的初始化
                var locationUrl = window.location.href;
                var arrUrl = locationUrl.split("/");
                var CID = arrUrl[arrUrl.length - 1];
                var CityID = "";
                if (CID.split('#').length != 0) {
                    var arrcity = CID.split('#');
                    CityID = arrcity[0];
                } else {
                    CityID = CID;
                }

                getCityInitLatLng(CityID);
                initMap(initlat, initlng);
            }

            document.getElementById('container-2').style["visibility"] = "hidden";
            document.getElementById("categoryID").value = '3';
        })


    })
}
//当点击第二个TAB的时候调用的方法
function ClickMenu002(ID) {
    $('#aMenu002').click(function() {
        //当调用的时候对两个标签赋初始值
        document.getElementById("pageID").value = '1';
        document.getElementById("categoryID").value = '4';
        document.getElementById("checkPageNum").value = 'click';
        //通过JSON来对此出的数据进行查询
        $.getJSON('/City/ClickColumnInterface/4' + "," + ID + ",1", { t: new Date() }, function(j) {
            var arrmark = markArr.split('&');

            var arr = new Array();
            var s = null;
            //判断查询出的是否有数据
            if (j.length != 0) {
                //通过FOR循环来得到不同的值
                for (var i = 0; i < j.length; i++) {
                    //通过分割来得到不同的值
                    var value = j[i];
                    arr = value.split('|');
                    //得到商户名称
                    var shopName = arr[0];
                    //得到商户ID
                    var shopID = arr[1];
                    //得到商户的LOGO
                    var shopLogoUrl = arr[2];
                    //得到商户的信息
                    var shopMessage = arr[3];
                    if (shopLogoUrl == "" || shopLogoUrl == null) {
                        shopLogoUrl = '/Content/img/home/iniImg.bmp';
                    }
                    //来对商户信息进行字数分割
                    var message = "";
                    if (i == 0) {
                        message = shopMessage.substring(0, 68);
                    }
                    else {
                        message = shopMessage.substring(0, 29);
                    }
                    //根据具体的信息内容来对各个标签进行赋值
                    $("#lb_junketing" + (i + 1)).html("标签:" + arrmark[i]);
                    $("#junketingName" + (i + 1)).html(shopName);
                    $("#junketingMessage" + (i + 1)).html(message + '...');
                    $("#junketing" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#junketing" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#firstJunketing" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#junketingImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#junketingParticularMessage" + (i + 1)).html('>>>>>>详细信息');
                    //控制TAB上的数据显示
                    document.getElementById("junketingMessage" + (i + 1)).style["visibility"] = "visible";
                    //document.getElementById("junketing" + (getJsonNum + 1)).title = shopName + "欢迎您";
                    document.getElementById("junketing" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("firstJunketing" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("junketingImg" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("lb_junketing" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("junketingName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("junketingParticularMessage" + (i + 1)).style["visibility"] = "visible";
                    getJsonNum = i + 1;

                }

                //如果查询出的数据不足五条信息的显示
                if (getJsonNum != 5) {
                    //根据具体有多少条记录来记性计算
                    var getJsonNumi = 5 - getJsonNum;

                    //根据循环来对各个标签进行操作
                    for (var p = getJsonNum; p < 5; p++) {

                        document.getElementById("junketingMessage" + (p + 1)).style["visibility"] = "hidden";
                        //document.getElementById("junketing" + (getJsonNum + 1)).title = shopName + "欢迎您";
                        document.getElementById("junketing" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("firstJunketing" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("junketingImg" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("lb_junketing" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("junketingName" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("junketingParticularMessage" + (p + 1)).style["visibility"] = "hidden";
                    }
                }

                //判断是否为第一次加载的信息

                if (document.getElementById("checkPageNum").value != 'init' && document.getElementById("checkjunketing").value != "1") {

                    category = '4';
                    //对此TAB来进行分页程序的操作

                    getPageNum(ID, '4', 'pageNum_tb');

                    document.getElementById("checkjunketing").value = "1";
                    document.getElementById("checkPageNum").value = 'click';
                }

                initTabName = 'lb_junketing';
                //创建MARKER
                getCityMarker();
                document.getElementById("junketinglinks").style["visibility"] = "visible";
                document.getElementById("hiddenLable").style["visibility"] = "hidden";
                //如果没有任何信息对TABLE的显示的初始化
            } else {
                document.getElementById("junketinglinks").style["visibility"] = "hidden";
                document.getElementById("hiddenLable").innerText = "暂无任何信息";
                //当数据为空的时候对地图的初始化
                var locationUrl = window.location.href;
                var arrUrl = locationUrl.split("/");
                var CID = arrUrl[arrUrl.length - 1];
                var CityID = "";
                if (CID.split('#').length != 0) {
                    var arrcity = CID.split('#');
                    CityID = arrcity[0];
                } else {
                    CityID = CID;
                }

                getCityInitLatLng(CityID);
                initMap(initlat, initlng);
            }

            document.getElementById('container-2').style["visibility"] = "hidden";
            document.getElementById("categoryID").value = '4';
        })

    })
}
//当点击第三个TAB的时候调用的方法
function ClickMenu003(ID) {
    $('#aMenu003').click(function() {
        //当调用的时候对两个标签赋初始值
        document.getElementById("pageID").value = '1';
        document.getElementById("categoryID").value = '1';
        document.getElementById("checkPageNum").value = 'click';
        //通过JSON来对此出的数据进行查询
        $.getJSON('/City/ClickColumnInterface/1' + "," + ID + ",1", { t: new Date() }, function(j) {

            var arr = new Array();
            var s = null;
            var arrmark = markArr.split('&');
            //判断查询出的是否有数据
            if (j.length != 0) {
                //通过FOR循环来得到不同的值
                for (var i = 0; i < j.length; i++) {
                    //通过分割来得到不同的值
                    var value = j[i];
                    arr = value.split('|');
                    //得到商户名称
                    var shopName = arr[0];
                    //得到商户ID
                    var shopID = arr[1];
                    //得到商户的LOGO
                    var shopLogoUrl = arr[2];
                    //得到商户的信息
                    var shopMessage = arr[3];
                    if (shopLogoUrl == "" || shopLogoUrl == null) {
                        shopLogoUrl = '/Content/img/home/iniImg.bmp';
                    }
                    //来对商户信息进行字数分割
                    var message = "";
                    if (i == 0) {
                        message = shopMessage.substring(0, 68);
                    }
                    else {
                        message = shopMessage.substring(0, 29);
                    }
                    //根据具体的信息内容来对各个标签进行赋值
                    $("#lb_dietetic" + (i + 1)).html("标签:" + arrmark[i]);
                    $("#dieteticName" + (i + 1)).html(shopName);
                    $("#dieteticMessage" + (i + 1)).html(message + '...');
                    $("#dietetic" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#dietetic" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#FirstDietetic" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#dieteticImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#dieteticParticularMessage" + (i + 1)).html('>>>>>>详细信息');
                    //控制TAB上的数据显示
                    document.getElementById("dieteticMessage" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("dietetic" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("FirstDietetic" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("dieteticImg" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("lb_dietetic" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("dieteticName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("dieteticParticularMessage" + (i + 1)).style["visibility"] = "visible";
                    getJsonNum = i + 1;
                }
                //如果查询出的数据不足五条信息的显示
                if (getJsonNum != 5) {
                    //根据具体有多少条记录来记性计算
                    var getJsonNumi = 5 - getJsonNum;
                    //根据循环来对各个标签进行操作
                    for (var p = getJsonNum; p < 5; p++) {

                        document.getElementById("dieteticMessage" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("dietetic" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("FirstDietetic" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("dieteticImg" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("lb_dietetic" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("dieteticName" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("dieteticParticularMessage" + (p + 1)).style["visibility"] = "hidden";
                    }
                }
                //判断是否为第一次加载的信息

                if (document.getElementById("checkPageNum").value != 'init' && document.getElementById("checkdietetic").value != "1") {
                    document.getElementById("checkdietetic").value = "1";
                    document.getElementById("checkPageNum").value = 'click';

                    category = '1';
                    //对此TAB来进行分页程序的操作
                    getPageNum(ID, '1', 'dietetic_tb');

                }
                initTabName = 'lb_dietetic';
                //创建MARKER
                getCityMarker();
                document.getElementById("dieteticlinks").style["visibility"] = "visible";
                document.getElementById("hiddenLable2").style["visibility"] = "hidden";
                //如果没有任何信息对TABLE的显示的初始化
            } else {

                document.getElementById("dieteticlinks").style["visibility"] = "hidden";
                document.getElementById("hiddenLable2").innerText = "暂无任何信息";
                //当数据为空的时候对地图的初始化
                var locationUrl = window.location.href;
                var arrUrl = locationUrl.split("/");
                var CID = arrUrl[arrUrl.length - 1];
                var CityID = "";
                if (CID.split('#').length != 0) {
                    var arrcity = CID.split('#');
                    CityID = arrcity[0];
                } else {
                    CityID = CID;
                }

                getCityInitLatLng(CityID);
                //alert(initlat + "," + initlng);
                initMap(initlat, initlng);
            }

            document.getElementById('container-2').style["visibility"] = "hidden";
            document.getElementById("categoryID").value = '1';
        })
    })
}
//当点击第五个TAB的时候调用的方法
function ClickMenu005(ID) {
    $('#aMenu005').click(function() {
        //当调用的时候对两个标签赋初始值
        document.getElementById("pageID").value = '1';
        document.getElementById("categoryID").value = '2';
        document.getElementById("checkPageNum").value = 'click';
        //通过JSON来对此出的数据进行查询
        $.getJSON('/City/ClickColumnInterface/2' + "," + ID + ",1", { t: new Date() }, function(j) {
            var arr = new Array();
            var s = null;
            var arrmark = markArr.split('&');
            //判断查询出的是否有数据
            if (j.length != 0) {
                //通过FOR循环来得到不同的值
                for (var i = 0; i < j.length; i++) {
                    //通过分割来得到不同的值
                    var value = j[i];
                    arr = value.split('|');
                    //得到商户名称
                    var shopName = arr[0];
                    //得到商户ID
                    var shopID = arr[1];
                    //得到商户的LOGO
                    var shopLogoUrl = arr[2];
                    //得到商户的信息
                    var shopMessage = arr[3];
                    if (shopLogoUrl == "" || shopLogoUrl == null) {
                        shopLogoUrl = '/Content/img/home/iniImg.bmp';
                    }
                    //来对商户信息进行字数分割
                    var message = "";
                    if (i == 0) {
                        message = shopMessage.substring(0, 68);
                    }
                    else {
                        message = shopMessage.substring(0, 29);
                    }
                    //根据具体的信息内容来对各个标签进行赋值
                    $("#lb_quarter" + (i + 1)).html("标签:" + arrmark[i]);
                    $("#quarterName" + (i + 1)).html(shopName);
                    $("#quarterMessage" + (i + 1)).html(message + '...');
                    $("#quarter" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#quarter" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#firstQuarter" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#quarterImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#quarterParticularMessage" + (i + 1)).html('>>>>>>详细信息');
                    //控制TAB上的数据显示
                    document.getElementById("quarterMessage" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("quarter" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("firstQuarter" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("quarterImg" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("lb_quarter" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("quarterName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("quarterParticularMessage" + (i + 1)).style["visibility"] = "visible";
                    getJsonNum = i + 1;

                }
                //如果查询出的数据不足五条信息的显示
                if (getJsonNum != 5) {
                    //根据具体有多少条记录来记性计算
                    var getJsonNumi = 5 - getJsonNum;
                    //根据循环来对各个标签进行操作
                    for (var p = getJsonNum; p < 5; p++) {

                        document.getElementById("quarterMessage" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("quarter" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("firstQuarter" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("quarterImg" + (p + 1)).style["visibility"] = "hidden";

                        document.getElementById("lb_quarter" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("quarterName" + (p + 1)).style["visibility"] = "hidden";
                        document.getElementById("quarterParticularMessage" + (p + 1)).style["visibility"] = "hidden";
                    }
                }
                //判断是否为第一次加载的信息
                if (document.getElementById("checkPageNum").value != 'init' && document.getElementById("checkquarter").value != "1") {

                    document.getElementById("checkPageNum").value = 'click';
                    document.getElementById("checkquarter").value = "1";
                    category = '2';
                    //对此TAB来进行分页程序的操作
                    getPageNum(ID, '2', 'quarter_tb');
                }

                initTabName = 'lb_quarter';
                //创建MARKER
                getCityMarker();
                document.getElementById("quarterlinks").style["visibility"] = "visible";
                document.getElementById("hiddenLable4").style["visibility"] = "hidden";
                //如果没有任何信息对TABLE的显示的初始化
            } else {
                document.getElementById("quarterlinks").style["visibility"] = "hidden";
                document.getElementById("hiddenLable4").innerText = "暂无任何信息";
                //当数据为空的时候对地图的初始化
                var locationUrl = window.location.href;
                var arrUrl = locationUrl.split("/");
                var CID = arrUrl[arrUrl.length - 1];
                var CityID = "";
                if (CID.split('#').length != 0) {
                    var arrcity = CID.split('#');
                    CityID = arrcity[0];
                } else {
                    CityID = CID;
                }

                getCityInitLatLng(CityID);
                //alert(initlat + "," + initlng);
                initMap(initlat, initlng);
            }
            document.getElementById('container-1').style["visibility"] = "hidden";
            document.getElementById("categoryID").value = '2';
        })
    })
}

function ClickMenu007(ID) {
    //点击箭头按钮的时候对TAB显示的操作
    $("#aMenu007").click(function() {
        var s = null;

        if (document.getElementById('container-1').style["visibility"] == "hidden") {
            
            document.getElementById('container-1').style["visibility"] = "visible";
            document.getElementById('Menu001').style['background'] = 'none';
            document.getElementById('Menu002').style['background'] = 'url(../../Content/img/jquery/tab.gif)';
            document.getElementById('Menu003').style['background'] = 'url(../../Content/img/jquery/tab.gif)';
            document.getElementById('container-2').style["visibility"] = "hidden";
            document.getElementById("searchLinks").style["visibility"] = "hidden";
            //alert('test');
            //控制搜索和住宿TAB的不和第一项的内容重叠
            for (var p = 0; p < 5; p++) {
                document.getElementById("searchMessage" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("lb_search" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("search" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("FirstSearch" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("searchImg" + (p + 1)).style["visibility"] = "hidden";

                document.getElementById("lb_quarter" + (p + 1)).style["visibility"] = "hidden";
                //document.getElementById("searchName" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("searchParticularMessage" + (p + 1)).style["visibility"] = "hidden";

                document.getElementById("quarterMessage" + (p + 1)).style["visibility"] = "hidden";

                document.getElementById("quarter" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("firstQuarter" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("quarterImg" + (p + 1)).style["visibility"] = "hidden";

                document.getElementById("lb_quarter" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("quarterName" + (p + 1)).style["visibility"] = "hidden";
                
                document.getElementById("quarterParticularMessage" + (p + 1)).style["visibility"] = "hidden";
            }


            category = '3';
            //根据默认值来得到第一个显示的TAB的东西
            document.getElementById("testTrademarkSearch").value = 'testNO';

            getRightCloumn(ID);
            //clickSerach();
        }
        else {

            document.getElementById('container-2').style["visibility"] = "visible";
            document.getElementById('Menu005').style['background'] = 'url(../../Content/img/jquery/tab.gif)';
            document.getElementById('container-1').style["visibility"] = "hidden";
            document.getElementById("searchLinks").style["visibility"] = "hidden";


            if (document.getElementById("hidden_CitySearch").innerText != "1") {
                document.getElementById("hiddenLable3").innerText = "暂无任何查询信息";
            }

            category = '4';
            //控制前面的图片不会现实在后面的TAB中
            for (var p = 0; p < 5; p++) {

                document.getElementById("ParticularMessage" + (p + 1)).style["visibility"] = "hidden";

                document.getElementById("Shop" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("firstShop" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("shopLogoImg" + (p + 1)).style["visibility"] = "hidden";

                document.getElementById("index" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("shopName" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("ParticularMessage" + (p + 1)).style["visibility"] = "hidden";


                document.getElementById("junketingMessage" + (p + 1)).style["visibility"] = "hidden";
                //document.getElementById("junketing" + (getJsonNum + 1)).title = shopName + "欢迎您";
                document.getElementById("junketing" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("firstJunketing" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("junketingImg" + (p + 1)).style["visibility"] = "hidden";

                document.getElementById("lb_junketing" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("junketingName" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("junketingParticularMessage" + (p + 1)).style["visibility"] = "hidden";


                document.getElementById("dieteticMessage" + (p + 1)).style["visibility"] = "hidden";

                document.getElementById("dietetic" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("FirstDietetic" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("dieteticImg" + (p + 1)).style["visibility"] = "hidden";

                document.getElementById("lb_dietetic" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("dieteticName" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("dieteticParticularMessage" + (p + 1)).style["visibility"] = "hidden";




            }
            //根据默认值来得到第一个显示的TAB的东西

            document.getElementById("testTrademarkSearch").value = 'testNO';
            //alert(document.getElementById("serachID").value + "," + document.getElementById("resultCount").value);
            s = document.getElementById("serachID").value + "|" + document.getElementById("resultCount").value + "|1";
            WriteSerachTable(s);
        }
    })
}

//清空标签数据
function CleanTable() {

    $("#shopName" + (i + 1)).html("");
    document.getElementById("messageShop" + (i + 1)).innerText = '';
    document.getElementById("Shop" + (i + 1)).title = '';
    document.getElementById("Shop" + (i + 1)).href = '';
    //ocument.getElementById("Shop" + (i + 1)).rel = '/City/Trademark/' + shopID;
    document.getElementById("firstShop" + (i + 1)).href = '';
    document.getElementById("shopLogoImg" + (i + 1)).src = "";
    document.getElementById("ParticularMessage" + (i + 1)).innerText = '';
}

//点击某个页码以后得到相应的数据
function test(pageInt) {

    var categoryPageID = document.getElementById("categoryID").value;
    var CityID = cityID;
    var tableName = "";

    //把现在的几个值赋给想对应的标签
    document.getElementById("cityID").value = CityID;
    document.getElementById("categoryID").value = categoryPageID;
    document.getElementById("pageID").value = pageInt;
    //alert(page);
    //根据点击的页码数,城市ID,CATEGORYID来进行数据查询
    $.getJSON('/City/ClickPage/' + pageInt + "," + CityID + "," + categoryPageID, { t: new Date() }, function(j) {

        var arr = new Array();
        var s = null;
        var pageNumSum = '';
        //如果查询的数据不为空的话来进行判断
        if (j.length != 0) {
            //如果查询数据不超过5条以上的显示
            if (j.length > 4) {
                pageNumSum = '5';
                //查询数据不超过五条的显示
            } else {
                pageNumSum = j.length;
            }
            //通过循环来对查询出的数据进行显示操作
            for (var i = 0; i < pageNumSum; i++) {
                //通过分割来得到我们所要的数据
                var value = j[i];
               // alert(value);
                arr = value.split('★');
                //得到商户名称
                var shopName = arr[0];
                //得到商户ID
                var shopID = arr[1];
                //得到商户的LOGO地址
                var shopLogoUrl = arr[2];
                if (shopLogoUrl == "" || shopLogoUrl == null) {
                    shopLogoUrl = '/Content/img/home/iniImg.bmp';
                }
                //得到商户信息并对商户信息进行字数分割
                var shopMessage = arr[3];
                var message = "";
                if (i == 0) {
                    message = shopMessage.substring(0, 68);
                }
                else {
                    message = shopMessage.substring(0, 29);
                }
                //判断CATEGORYID的值来对不同的TABLE进行赋值
                if (categoryPageID == "3") {
                    //$("#index" + (i + 1)).html("标签:" + arrmark[i]);

                    $("#shopName" + (i + 1)).html(shopName);
                    $("#messageShop" + (i + 1)).html(message + '...');
                    $("#Shop" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#shopLogoImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#ParticularMessage" + (i + 1)).html(">>>>>>详细信息");
                    $("#Shop" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#firstShop" + (i + 1)).attr("href", '/City/Trademark/' + shopID);

                    tableName = 'shop_tb';
                    //控制TAB上的数据显示

                    document.getElementById("index" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("shopName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("messageShop" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("Shop" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("firstShop" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("shopLogoImg" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("ParticularMessage" + (i + 1)).style["visibility"] = "visible";


                }
                //判断CATEGORYID的值来对不同的TABLE进行赋值
                if (categoryPageID == "4") {
                    // $("#lb_junketing" + (i + 1)).html("标签:" + arrmark[i]);
                    $("#junketingName" + (i + 1)).html(shopName);
                    $("#junketingMessage" + (i + 1)).html(message + '...');
                    $("#junketing" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#junketing" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#firstJunketing" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#junketingImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#junketingParticularMessage" + (i + 1)).html('>>>>>>详细信息');
                    tableName = 'pageNum_tb';

                    //控制TAB上的数据显示
                    document.getElementById("lb_junketing" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("junketingName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("junketingMessage" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("junketing" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("firstJunketing" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("junketingImg" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("junketingParticularMessage" + (i + 1)).style["visibility"] = "visible";

                }
                //判断CATEGORYID的值来对不同的TABLE进行赋值
                if (categoryPageID == "1") {
                    //$("#lb_dietetic" + (i + 1)).html("标签:" + arrmark[i]);
                    $("#dieteticName" + (i + 1)).html(shopName);
                    $("#dieteticMessage" + (i + 1)).html(message + '...');
                    $("#dietetic" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#dietetic" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#FirstDietetic" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#dieteticImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#dieteticParticularMessage" + (i + 1)).html('>>>>>>详细信息');

                    tableName = 'dietetic_tb';

                    //控制TAB上的数据显示
                    document.getElementById("lb_dietetic" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("dieteticName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("dieteticMessage" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("dietetic" + (i + 1)).style["visibility"] = "visible";


                    document.getElementById("dieteticImg" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("dieteticParticularMessage" + (i + 1)).style["visibility"] = "visible";

                }
                //判断CATEGORYID的值来对不同的TABLE进行赋值
                if (categoryPageID == "2") {
                    // $("#lb_quarter" + (i + 1)).html("标签:" + arrmark[i]);
                    $("#quarterName" + (i + 1)).html(shopName);
                    $("#quarterMessage" + (i + 1)).html(message + '...');
                    $("#quarter" + (i + 1)).attr("title", shopName + "欢迎您");
                    $("#quarter" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#firstQuarter" + (i + 1)).attr("href", '/City/Trademark/' + shopID);
                    $("#quarterImg" + (i + 1)).attr("src", shopLogoUrl);
                    $("#quarterParticularMessage" + (i + 1)).html('>>>>>>详细信息');

                    tableName = 'quarter_tb';
                    //控制TAB上的数据显示

                    document.getElementById("lb_quarter" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("quarterName" + (i + 1)).style["visibility"] = "visible";
                    document.getElementById("quarterParticularMessage" + (t + 1)).style["visibility"] = "visible";
                    document.getElementById("quarter" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("quarterImg" + (i + 1)).style["visibility"] = "visible";

                    document.getElementById("quarterParticularMessage" + (i + 1)).style["visibility"] = "visible";

                }
            } //FOR结束
            //如果此页数据不足五条的显示操作
            if (pageNumSum < 5) {

                for (var t = pageNumSum; t < 5; t++) {
                    //根据不同的CATEGORYID来对不同的标签进行显示
                    if (categoryPageID == "3") {
                        document.getElementById("index" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("shopName" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("messageShop" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("Shop" + (t + 1)).style["visibility"] = "hidden";

                        document.getElementById("firstShop" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("shopLogoImg" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("ParticularMessage" + (t + 1)).style["visibility"] = "hidden";

                        //tableName = 'shop_tb';


                    }
                    //根据不同的CATEGORYID来对不同的标签进行显示
                    if (categoryPageID == "4") {
                        document.getElementById("lb_junketing" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("junketingName" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("junketingMessage" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("junketing" + (t + 1)).style["visibility"] = "hidden";

                        document.getElementById("firstJunketing" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("junketingImg" + (t + 1)).style["visibility"] = "hidden";

                        document.getElementById("junketingParticularMessage" + (t + 1)).style["visibility"] = "hidden";

                        // tableName = 'pageNum_tb';


                    }
                    //根据不同的CATEGORYID来对不同的标签进行显示
                    if (categoryPageID == "1") {
                        document.getElementById("lb_dietetic" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("dieteticName" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("dieteticMessage" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("dietetic" + (t + 1)).style["visibility"] = "hidden";


                        document.getElementById("dieteticImg" + (t + 1)).style["visibility"] = "hidden";

                        document.getElementById("dieteticParticularMessage" + (t + 1)).style["visibility"] = "hidden";

                        // tableName = 'dietetic_tb';

                    }
                    //根据不同的CATEGORYID来对不同的标签进行显示
                    if (categoryPageID == "2") {
                        document.getElementById("lb_quarter" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("quarterName" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("quarterParticularMessage" + (t + 1)).style["visibility"] = "hidden";
                        document.getElementById("quarter" + (t + 1)).style["visibility"] = "hidden";

                        document.getElementById("quarterImg" + (t + 1)).style["visibility"] = "hidden";

                        document.getElementById("quarterParticularMessage" + (t + 1)).style["visibility"] = "hidden";

                        // tableName = 'quarter_tb';
                    }
                }
            }
        } //if结束


        //根据点击的页码和TABLENAME来进行后续的页码的显示
        //alert(page);
        jumpPageNum(pageInt, tableName, page);


    })
    //创建相对应的MARKER
    getCityMarker();

}



//根据点击的页码和TABLENAME来进行后续的页码的显示
function jumpPageNum(pageInt, jumpTableName,page) {
    //清空页码显示的TABLE
    //
    var tabRows = document.getElementById(jumpTableName).rows.length;

    var tb = document.getElementById(jumpTableName);

    if (tabRows != '0') {
        tb.deleteRow(0);
    }
    //对此TABLE的默认显示
   // tr1 = document.getElementById(jumpTableName).insertRow();

    //计算新的页码显示的开始页码
    //alert(page);
    var startPageNum = pageInt - 2;
    //alert();
    if (pageInt == page) {
        startPageNum = page - 5;
    }
    //alert(page);
    if (startPageNum <= 4) {
        startPageNum = 0;
    }
    //alert(startPageNum);
    
    //计算新的页码显示的结束页码

    var endPageNum = pageInt + 3;
    if (startPageNum == 0) {
        endPageNum = startPageNum + 5;
    }
    if (endPageNum >= page) {
        
        endPageNum = page;
    }
    //得到我们要显示的页码数
    var sumPage = (endPageNum - startPageNum);

    if (sumPage < 0) {

        sumPage = endPageNum;
    }


    //根据开始页码和结束页码来对页码进行新的显示操作
    var tg = "#" + jumpTableName + ">tbody>tr>td:last";
    tr_id = $(tg).attr("id");
    tr_id++;
    var str1 = "<tr id = '" + tr_id + "'>";
    var str2 = "</tr>";
    var std = "";
    //alert(tr_id);
    //得到一共需要分成几页
    var s = "";
    var page = 0;
    page = parseInt(s);

    if (s > page) {
        page = page + 1;
    }
    //通过循环来把页码显示在页面上
    for (var j = startPageNum; j < endPageNum; j++) {


        std += "<td width='20px'><a href='#' onclick='test(" + (j+1) + ");' id='pageUrl'" + (j+1) + " class='link'>" + (j+1) + "</a></td>";

    }

    var strtd = str1 + std + str2;

    $('#' + jumpTableName).append(strtd);
    
    
    
    
    
    

//    for (var j = startPageNum; j < (endPageNum + 1); j++) {

//        var td1 = tr1.insertCell();
//        td1.width = "20px";
//        td1.innerHTML = "<a href='#' onclick='test(" + j + ");' id='pageUrl'" + j + " class='link'>" + j + "</a>";

//    }

}




function initSite() {
    //热点城市ID查询

    //加载首页城市介绍数据--需修改调用/Home/HotCity/1，查到
    initMap(initlat, initlng);
    initMarkerManager();

    getCityMarker();

}

function initMarkerManager() {
    markerManager = new MarkerManager(map);
    markerManager.refresh();
}

function getAddress(overlay, latlng) {
    if (latlng != null) {
        address = latlng;
        geocoder.getLocations(latlng, showAddress);
    }
}

function initMap(initlat, initlng) {

    if (GBrowserIsCompatible()) {
        //lat lng需要从数据库中读出第一个，作为地图的zoom
        var lat = initlat;   // zoom to the whole japan
        var lng = initlng;
        var scale = 13;
        var options = {
            searchFormHint: "交通线路查询,请输入目的地名称或地址"
        };

        map = new GMap2(document.getElementById("map_canvas"));
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.enableDoubleClickZoom();
        map.continuousZoomEnabled();
        map.setCenter(new GLatLng(lat, lng), scale);

        map.addControl(new google.maps.LocalSearch(options), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(70, 5)));

    } // GBrowserIsCompatible
}


function createShop(latlng, shopMessage, shopID, shopLogo, shopType, index) {


    //对各个经纬度进行比对
    //进行第一个对比
    var marker = "";

    //开始建立MARKER
    marker = new createMarker(latlng, index, shopID);

    markerManager.addMarker(marker, 1);
    markerManager.refresh();

    //点击了以后弹出小窗口
    GEvent.addListener(marker, "click", function() {
        var myHtml = "<table align='left' id=''><tr><td align='left' width='260px'><img src=" + shopLogo + " height='80px' width='100px' hspace='5' align='left'>" + "</img>" + shopMessage + "</td></tr><tr><td><a href = '/City/Trademark/" + marker.value + "'>更多详细信息</a></td></tr></table>";
        map.openInfoWindowHtml(latlng, myHtml);

    });

    GEvent.addListener(marker, "popup", function() {
        var myHtml = "<table align='left' id=''><tr><td align='left' width='260px'><img src=" + shopLogo + " height='80px' width='100px' hspace='5' align='left'>" + "</img>" + shopMessage + "</td></tr><tr><td><a href = '/City/Trademark/" + marker.value + "'>更多详细信息</a></td></tr></table>";
        map.openInfoWindowHtml(latlng, myHtml);


    });

    return marker;
}
//进行MARKER的数据查询和显示
function getCityMarker() {

    var bound = map.getBounds();

    var northEast = bound.getNorthEast();
    var southWest = bound.getSouthWest();
    //从不同的标签来得到当前的几个数值

    var categoryID = document.getElementById("categoryID").value;
    var cityID = document.getElementById("cityID").value;
    var pageID = document.getElementById("pageID").value;

    var param = "/City/GetCityMarker/" + northEast.lat() + "," + northEast.lng() + "," + southWest.lat() + "," + southWest.lng() + "," + cityID + "," + categoryID + "," + pageID;
    //alert(param);
    $.getJSON(param, { t: new Date() }, function(j) {
        //alert(j[0]);
        var goValue = j[0];

        var goArr = new Array();
        var opinion = '0';
        if (goValue != "nothing") {
            //如果查询出的数据不为空,进行数据分割操作,来得到具体要得到的数据
            goArr = goValue.split('|');
            //得到默认的经纬度
            var ilat = goArr[0];
            var ilng = goArr[1];

            var arrmark = markArr.split('&');
            var arr = new Array();
            //通过循环来得到不同商户的不同信息
            for (var i = 0; i < j.length; i++) {
                //分割数据来得到需要的具体信息
                var value = j[i];

                arr = value.split('|');
                //得到此商户的经纬度
                var lat = arr[0];
                var lng = arr[1];
                //得到此商户的默认信息
                var cityMarkInitLat = arr[6];
                var cityMarkInitLng = arr[7];

                //得到此商户的ID
                var shopID = arr[2];
                //做标志为用的变量

                if (i == 0) {
                    if (lat != 0 && lng != 0 && lat != "" && lng != "") {
                        // alert('test0');
                        initMap(lat, lng);
                        opinion = 1;
                    }
                } else if (i == 1 && opinion == '0') {
                    if (lat != 0 && lng != 0 && lat != "" && lng != "") {
                        // alert('test1');
                        initMap(lat, lng);
                        opinion = 1;
                    }
                } else if (i == 2 && opinion == '0') {
                    if (lat != 0 && lng != 0 && lat != "" && lng != "") {
                        // alert('test2');
                        initMap(lat, lng);
                        opinion = 1;
                    }
                } else if (i == 3 && opinion == '0') {
                    if (lat != 0 && lng != 0 && lat != "" && lng != "") {
                        //alert('test3');
                        initMap(lat, lng);
                        opinion = 1;
                    }
                } else if (i == 4 && opinion == '0') {
                    if (lat != 0 && lng != 0 && lat != "" && lng != "") {
                        //alert('test4');
                        initMap(lat, lng);
                        opinion = 1;
                    }
                } else {
                    if (opinion == '0') {
                        initMap(cityMarkInitLat, cityMarkInitLng);
                    }
                }

                //得到商户的LOGO路径
                var shopLogo = arr[3];
                //得到商户的信息
                var shopMessage = arr[4];
                //得到商户的TYPE
                var shopType = arr[5];

                var marker = "";
                if (lat != 0 && lng != 0) {

                    //对各个经纬度进行比对
                    //第一步,得到第一个商户的经纬度
                    if (i == '0') {

                        shopLat1 = lat;
                        shopLng1 = lng;

                        //当得到第一个商户的经纬度的时候传入INDEX为0,这样来写掉对MARKER的控制
                        marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '0');


                    }
                    //进行第二个商户比对
                    if (i == '1') {

                        shopLat2 = lat;
                        shopLng2 = lng;

                        //在得到第二个商户的经纬度的时候对经纬度进行对比
                        if ((shopLat1 == shopLat2) && (shopLng1 == shopLng2)) {
                            //如果经纬度相同就对其的标签进行赋值
                            $(initTabName + '2').html($(initTabName + '1').html);
                            //document.getElementById(initTabName + '2').innerHTML = document.getElementById(initTabName + '1').innerHTML;
                            //如果经纬度相同就对其的MARKER进行控制

                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '0');
                        } else {
                            //给标签重新赋值
                            $(initTabName + '2').html('标签:B');
                            //document.getElementById(initTabName + '2').innerHTML = ;
                            //如果经纬度不相同就对其的MARKER进行正常的显示

                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '1');
                        }
                    }
                    //进行第三个商户比对
                    if (i == '2') {

                        shopLat3 = lat;
                        shopLng3 = lng;
                        //如果第三个商户的经纬度不和第二个一样,就把第三个商户的经纬度和第一个商户做对比
                        if ((shopLat1 == shopLat3) && (shopLng1 == shopLng3)) {
                            //如果第三个商户的经纬度和第一个相同,则把第三个商户的标签和第一个商户的标签一样
                            //document.getElementById(initTabName + '3').innerHTML = document.getElementById(initTabName + '1').innerHTML;
                            $(initTabName + '3').html($(initTabName + '1').html);
                            //控制第三个商户的MARKER显示和第一个商户的MARKER一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '0');
                        }
                        //在得到第三个商户的经纬度的时候把它与第二个商户的经纬度进行对比
                        if ((shopLat2 == shopLat3) && (shopLng2 == shopLng3) && (shopLat1 != shopLat3) && (shopLng1 != shopLng3)) {
                            //如果经纬度相同就对其标签进行赋值
                            $(initTabName + '3').html($(initTabName + '2').html);
                            //document.getElementById(initTabName + '3').innerHTML = document.getElementById(initTabName + '2').innerHTML;
                            //如果第三个商户的经纬度和第二个商户相同,控制它的MARKER显示和第二个商户一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '1');

                        }
                        //如果它与前两个经纬度都不相同就正常生成
                        if ((shopLat2 != shopLat3) && (shopLng2 != shopLng3) && (shopLat1 != shopLat3) && (shopLng1 != shopLng3)) {
                            //给标签重新赋值
                            $(initTabName + '3').html('标签:C');
                            //document.getElementById(initTabName + '3').innerHTML = '标签:C';
                            //如果不和前面的商户警卫一样就进行正常的MARKER显示
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '2');
                        }
                    }
                    //进行第四个商户比对
                    if (i == '3') {

                        shopLat4 = lat;
                        shopLng4 = lng;

                        //在得到第四个商户的经纬度的时候把它与第一个商户的经纬度进行对比
                        if ((shopLat1 == shopLat4) && (shopLng1 == shopLng4)) {
                            //把第一个商户的标签赋给与它经纬度相同的第四个商户
                            $(initTabName + '4').html($(initTabName + '1').html);
                            //document.getElementById(initTabName + '4').innerHTML = document.getElementById(initTabName + '1').innerHTML;
                            //控制第四个商户的MARKER显示和第一个相同
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '0');
                            //如果第四个商户与第一个商户经纬度不一样,就让它与第二个商户对比
                        }
                        if ((shopLat2 == shopLat4) && (shopLng2 == shopLng4) && (shopLat1 != shopLat4) && (shopLng1 != shopLng4)) {
                            //把第二个商户的标签赋给第4个商户
                            $(initTabName + '4').html($(initTabName + '2').html);
                            //document.getElementById(initTabName + '4').innerHTML = document.getElementById(initTabName + '2').innerHTML;
                            //控制第四个商户的MARKER显示和第二个一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '1');
                            //如果第四个商户的经纬度和前面二个都不一样,则和第三个做比对
                        }
                        if ((shopLat3 == shopLat4) && (shopLng3 == shopLng4) && (shopLat2 != shopLat4) && (shopLng2 != shopLng4) && (shopLat1 != shopLat4) && (shopLng1 != shopLng4)) {
                            //把第三个商户的标签赋给第四个商户
                            $(initTabName + '4').html($(initTabName + '3').html);
                            //document.getElementById(initTabName + '4').innerHTML = document.getElementById(initTabName + '3').innerHTML;
                            //控制第四个商户的MARKER显示和第三个一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '2');
                        }
                        if ((shopLat1 != shopLat4) && (shopLng1 != shopLng4) && (shopLat2 != shopLat4) && (shopLng2 != shopLng4) && (shopLat3 != shopLat4) && (shopLng3 != shopLng4)) {
                            //给标签重新赋值
                            $(initTabName + '4').html('标签:D');
                            //document.getElementById(initTabName + '4').innerHTML = '标签:D';
                            //如果都不相同就正常显示MARKER
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '3');
                        }
                    }
                    //进行第五个商户比对
                    if (i == '4') {
                        shopLat5 = lat;
                        shopLng5 = lng;

                        //对比第五个商户是否和第一个商户有一样的经纬度
                        if ((shopLat1 == shopLat5) && (shopLng1 == shopLng5)) {
                            //如果第五个商户的经纬度和第一个一样,就把第五个商户的标签设置的和第一个标签一样
                            $(initTabName + '5').html($(initTabName + '1').html);
                            //document.getElementById(initTabName + '5').innerHTML = document.getElementById(initTabName + '1').innerHTML;
                            //控制第五个商户的MARKER显示和第一个商户一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '0');
                            //如果第五个商户和第一个商户经纬度不一样,则和第二个商户对比
                        }
                        if ((shopLat2 == shopLat5) && (shopLng2 == shopLng5) && (shopLat1 != shopLat5) && (shopLng1 != shopLng5)) {
                            //如果第五个商户和第二个商户一样,则第五个商户的标签就和第二个一样
                            $(initTabName + '5').html($(initTabName + '2').html);
                            //document.getElementById(initTabName + '5').innerHTML = document.getElementById(initTabName + '2').innerHTML;
                            //控制第无个商户的MARKER显示和第二个商户一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '1');
                            //如果第五个商户和前两个商户经纬度都不一样,则和第三个商户的经纬度做比对
                        }
                        if ((shopLat3 == shopLat5) && (shopLng3 == shopLng5) && (shopLat2 != shopLat5) && (shopLng2 != shopLng5) && (shopLat1 != shopLat5) && (shopLng1 != shopLng5)) {
                            //如果第五个商户和第三个商户一致,则让第五个商户的标签显示和第三个商户一样
                            $(initTabName + '5').html($(initTabName + '3').html);
                            //document.getElementById(initTabName + '5').innerHTML = document.getElementById(initTabName + '3').innerHTML;
                            //控制第五个商户的显示和第三个商户一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '2');
                            //如果第五个商户与前3个商户经纬度都不一样,则让第五个商户和第四个商户做比对
                        }
                        if ((shopLat4 == shopLat5) && (shopLng4 == shopLng5) && (shopLat3 != shopLat5) && (shopLng3 != shopLng5) && (shopLat2 != shopLat5) && (shopLng2 != shopLng5) && (shopLat1 != shopLat5) && (shopLng1 != shopLng5)) {
                            //如果第五个商户和第四个经纬度一样,则把第四个商户的标签赋给第五个商户
                            $(initTabName + '5').html($(initTabName + '4').html);
                            //document.getElementById(initTabName + '5').innerHTML = document.getElementById(initTabName + '4').innerHTML;
                            //控制第五个商户的MARKER显示和第四个商户一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '3');
                        }
                        if ((shopLat1 != shopLat5) && (shopLng1 != shopLng5) && (shopLat2 != shopLat5) && (shopLng2 != shopLng5) && (shopLat3 != shopLat5) && (shopLng3 != shopLng5) && (shopLat4 != shopLat5) && (shopLng4 != shopLng5)) {
                            //给标签重新赋值
                            $(initTabName + '5').html('标签:E');
                            //document.getElementById(initTabName + '5').innerHTML = '标签:E';
                            //如果都不一样则正常显示MARKER
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '4');
                        }
                    }


                    //当经纬度不存在0的时候显示标签

                    // document.getElementById(initTabName + (i + 1)).style["visibility"] = "visible";
                    $(initTabName + (i + 1)).attr("visibility", "visible");
                    // marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, i);
                    //在图层上显示地图
                    map.addOverlay(marker);
                } else {
                    //当经纬度为0的时候隐藏标签
                    $(initTabName + (i + 1)).attr("visibility", "hidden");
                    //document.getElementById(initTabName + (i + 1)).style["visibility"] = "hidden";
                }

                //给第一个TAB里的表格中完善它的连接
                if (document.getElementById("categoryID").value == '3') {
                    //alert('test');
                    $("#Shop" + (i + 1)).attr("href", '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng);
                    $("#firstShop" + (i + 1)).attr("href", '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng);
                    //document.getElementById("Shop" + (i + 1)).href = '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng;
                    //document.getElementById("firstShop" + (i + 1)).href = '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng;
                }
                //给第二个TAB里的表格中完善它的连接
                if (document.getElementById("categoryID").value == '4') {
                    $("#junketing" + (i + 1)).attr("href", '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng);
                    $("#firstJunketing" + (i + 1)).attr("href", '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng);
                    //document.getElementById("junketing" + (i + 1)).href = '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng;
                    // document.getElementById("firstJunketing" + (i + 1)).href = '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng;
                }
                //给第三个TAB里的表格中完善它的连接
                if (document.getElementById("categoryID").value == '1') {
                    $("#dietetic" + (i + 1)).attr("href", '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng);
                    $("#FirstDietetic" + (i + 1)).attr("href", '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng);

                    //document.getElementById("dietetic" + (i + 1)).href = '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng;
                    //document.getElementById("FirstDietetic" + (i + 1)).href = '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng;
                }
                //给第四个TAB里的表格中完善它的连接
                if (document.getElementById("categoryID").value == '2') {
                    $("#quarter" + (i + 1)).attr("href", '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng);
                    $("#firstQuarter" + (i + 1)).attr("href", '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng);

                    //document.getElementById("quarter" + (i + 1)).href = '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng;
                    //document.getElementById("firstQuarter" + (i + 1)).href = '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng;
                }
            }
        }

    });
}



function createMarker(point, index, shopID) {

    // Create a lettered icon for this point using our icon class

    var letter;

    //当INDEX为0的时候,控制显示的MARKER
    if (index == '0') {

        letter = String.fromCharCode("A".charCodeAt(0) + 0);
    }
    //当INDEX为1的时候,控制显示的MARKER
    if (index == '1') {

        letter = String.fromCharCode("A".charCodeAt(0) + 1);
    }
    //当INDEX为2的时候,控制显示的MARKER
    if (index == '2') {

        letter = String.fromCharCode("A".charCodeAt(0) + 2);
    }
    //当INDEX为3的时候,控制显示的MARKER
    if (index == '3') {

        letter = String.fromCharCode("A".charCodeAt(0) + 3);
    }
    //当INDEX为4的时候,控制显示的MARKER
    if (index == '4') {

        letter = String.fromCharCode("A".charCodeAt(0) + 4);
    }

    var letteredIcon = new GIcon();
    letteredIcon.image = "../../Content/img/shopType/marker" + letter + ".png";
    letteredIcon.shadow = "../../Content/img/shopType/shadow50.png";
    letteredIcon.iconSize = new GSize(20, 34);
    letteredIcon.shadowSize = new GSize(37, 34);
    letteredIcon.iconAnchor = new GPoint(9, 34);
    letteredIcon.infoWindowAnchor = new GPoint(9, 2);
    // Set up our GMarkerOptions object
    markerOptions = { icon: letteredIcon };
    var marker = new GMarker(point, markerOptions);
    marker.value = shopID;

    return marker;
}



function startPopupShop() {
    stopPopupFlag = false;
    popupNum = 0;
    loopPopupShop();
}

function stopPopupShop() {
    stopPopupFlag = true;
}

function resumePopupShop() {
    stopPopupFlag = false;
    loopPopupShop();
}

function loopPopupShop() {
    window.setTimeout(function() {
        if (stopPopupFlag == true) {
            stopPopupFlag = false;
            return;
        }
        var totalNum = shopList.length;
        var num = totalNum - 1 - popupNum;
        var currentMarker = shopList[num];
        GEvent.trigger(currentMarker, "popup");

        popupNum += 1;

        if (popupNum >= shopList.length)
            popupNum = 0;

        loopPopupShop();
    }

    , 3000);
}

//根据得到的城市ID来得到城市的天气
function getCityWeather(ID) {

    var param = "/Util/getCityWeather/" + ID;
    //通过JSON来得到具体的天气信息
    $.getJSON(param, { t: new Date() }, function(j) {

        var arr = new Array();
        //通过FOR循环来对标签进行赋值,以把信息显示在页面上
        for (var i = 0; i < j.length; i++) {
            var value = j[i];
            document.getElementById("WeatherCity" + (i + 1)).innerHTML = value;
        }

    });
}

//得到城市信息
function getCityMessage(ID) {

    var url = "/City/GetCityMessage/" + ID;
    //通过JSON来得到当前城市的具体信息
    $.getJSON(url, { t: new Date() }, function(j) {

        var arr = new Array();
        //通过FOR循环来得到具体信息
        for (var i = 0; i < j.length; i++) {
            //通过分割来得到各个值
            var vaule = j[i];

            arr = vaule.split('|');
            //的到城市中文名
            var cityNameCH = arr[0];
            //得到城市英文名
            var cityNameEN = arr[2];
            //得到城市日文名
            var cityNameJP = arr[3];
            //对相应的标签进行赋值
            $("#cityNameCH").html(cityNameCH);
            $("#cityNameEN").html(cityNameEN);
            $("#cityNameJP").html(cityNameJP);
//            document.getElementById("cityNameCH").innerHTML = cityNameCH;
//            document.getElementById("cityNameEN").innerHTML = cityNameEN;
//            document.getElementById("cityNameJP").innerHTML = cityNameJP;
            //得到此城市的具体信息介绍
            var cityMessage = arr[4];
            //设置初始化数据
            var num = 55;
            var sum = 1;
            //通过循环来对城市信息进行显示处理
            for (var k = 0; k < cityMessage.length; k++) {
                //分割出城市信息的内容
                var arrCityMessage = cityMessage.substring(k, num);

                ulMessage += arrCityMessage + "|";

                k += 54;
                //判断城市信息显示进行判断
                if (cityMessage.length - num < 55) {

                    num = cityMessage.length;

                } else {
                    num = k + 56;
                }
                sum += 1;

            }
            //通过分割来进行数据显示并加载LI标签对信息进行显示
            var arrulMessage = ulMessage.split('|');

            var ul = document.getElementById("testLiMessage");

            for (var b = 0; b < arrulMessage.length - 1; b++) {
                //加载标签并对其进行数据显示
                var li = document.createElement("li");

                var t = document.createTextNode(arrulMessage[b]);

                li.appendChild(t);
                ul.appendChild(li);
            }
            $('#testLiMessage').innerfade({
                animationtype: 'fade',
                speed: 750,
                timeout: 4000,
                type: 'sequence',
                containerheight: '1em'
            });
        }


    });
    //得到城市信息以后把生成标签



}

//点击查询按钮触发的事件
function clickSerach() {
    document.getElementById("testTrademarkSearch").value == 'testNO';
    //测试是否为第三页跳转来的
    //通过对URL的分割来得到具体值
    var locationUrl = window.location.href;
    var arrUrl = locationUrl.split("/");
    var CID = arrUrl[arrUrl.length - 1];
    var CityID = "";
    if (CID.split('#').length != 0) {
        var arrcity = CID.split('#');
        CityID = arrcity[0];
    } else {
        CityID = CID;
    }
    var category_s = "";
    var suburb_s = "";
    var categoryID = "";

    //获得查询中用户选择的各项参数
    var class_s = document.getElementById("Class").options[document.getElementById("Class").value - 1].text;

    if (document.getElementById("Suburb").disabled = "true") {

        suburb_s = "nothing";
    } else {
        suburb_s = document.getElementById("Suburb").options[document.getElementById("Suburb").value].text;
    }
    //判断用户如果没有选择具体项的话就默认为所有
    if (document.getElementById("TrademarkSearchCategoryID").value == " " || document.getElementById("TrademarkSearchCategoryID").value == "" || document.getElementById("TrademarkSearchCategoryID").value == null) {
        //

        if (document.getElementById("Category").value == 'first') {
            categoryID = '2';
        } else {
            categoryID = document.getElementById("Category").value;
        }
    } else {
        categoryID = document.getElementById("TrademarkSearchCategoryID").value;
    }
    //判断用来接第三页传过来的CATEGORYID的标签是否为空

    var param = "";

    //判断拥护是否选择了
    if (categoryID != "0") {
        if (suburb_s == "nothing") {

            param = '/City/SearchClick/' + CityID + "," + categoryID;
        } else {
            param = '/City/SearchClick/' + CityID + "," + categoryID;
        }
        //通过JSON来进行数据查询
        $.getJSON(param, { t: new Date() }, function(j) {
            var value = j[0];
            //判断查询的结果是否为空
            //如果不为空则进行TABLE书写
            if (value != null || value != "" || value != " ") {
                //调用TABLE赋值方法
                var value1 = value + "|" + "1";
                WriteSerachTable(value1);
                //如果为空则进行默认显示
            } else {
                //alert('testSearch3');
                document.getElementById("searchLinks").style["visibility"] = "hidden";
                document.getElementById("hiddenLable3").innerText = "暂无任何信息";
                document.getElementById('container-2').style["visibility"] = "visible";

                document.getElementById('Menu005').style['background'] = 'url(../../Content/img/jquery/tab.gif)';

                document.getElementById('container-1').style["visibility"] = "hidden";
                document.getElementById("searchLinks").style["visibility"] = "hidden";
            }
        })
    } else {

        //数据为空的默认显示
        //alert('testSearch4');
        document.getElementById("searchLinks").style["visibility"] = "hidden";
        document.getElementById("hiddenLable3").innerText = "暂无任何信息";
        document.getElementById('container-2').style["visibility"] = "visible";

        document.getElementById('Menu005').style['background'] = 'url(../../Content/img/jquery/tab.gif)';

        document.getElementById('container-1').style["visibility"] = "hidden";
        document.getElementById("searchLinks").style["visibility"] = "hidden";

    }

    document.getElementById("hidden_CitySearch").value = 'serachTab';


}
//对查询TABLE的数据显示
function WriteSerachTable(value) {

    //alert(value);
    var arr = new Array();
    arr = value.split('|');
    //给纪录标签添加值

    document.getElementById("serachID").value = arr[0];


    document.getElementById("resultCount").value = arr[1];


    var param = '/City/initSearchTable/' + arr[0] + "," + arr[1] + "," + arr[2] + ",5";


    //通过调用JSON来得到相应的数据
    $.getJSON(param, { t: new Date() }, function(j) {

        //当查询出的数据为空的时候进行默认数据的显示
        if (j.length == 0 || j[0] == "" || j[0] == null) {

            var locationUrl = window.location.href;
            var arrUrl = locationUrl.split("/");
            var CID = arrUrl[arrUrl.length - 1];
            var CityID = "";
            var fornum = "";
            if (CID.split('#').length != 0) {
                var arrcity = CID.split('#');
                CityID = arrcity[0];
            } else {
                CityID = CID;
            }
            //当查询出的记录为空的时候就让地图显示默认的地图
            getCityInitLatLng(CityID);

            for (var p = 0; p < 5; p++) {
                //alert(fornum);
                document.getElementById("searchMessage" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("lb_search" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("search" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("FirstSearch" + (p + 1)).style["visibility"] = "hidden";
                document.getElementById("searchImg" + (p + 1)).style["visibility"] = "hidden";

                document.getElementById("lb_quarter" + (p + 1)).style["visibility"] = "hidden";
                //document.getElementById("searchName" + (p + 1)).style["visibility"] = "hidden";
                $("#searchName" + (i + 1)).attr("visibility", "hidden");
                document.getElementById("searchParticularMessage" + (p + 1)).style["visibility"] = "hidden";

            }


            document.getElementById("searchLinks").style["visibility"] = "hidden";
            document.getElementById("hiddenLable3").innerText = "暂无任何信息";
            document.getElementById("hiddenLable3").style["visibility"] = "visible";
            document.getElementById("hidden_CitySearch").innerText = "";
            document.getElementById('container-2').style["visibility"] = "visible";

            document.getElementById('Menu005').style['background'] = 'url(../../Content/img/jquery/tab.gif)';

            document.getElementById('container-1').style["visibility"] = "hidden";

        } else {
            if (j.length < 5) {
                fornum = j.length;
            } else {
                fornum = 5;
            }
            var arr = new Array();
            var s = null;
            var opinion = 0;
            //通过FOR循环来得到各个信息
            for (var i = 0; i < fornum; i++) {

                //通过对查询出的数据进行分割得到具体的信息
                var value = j[i];

                arr = value.split('|');
                //得到商户名称
                var shopName = arr[0];
                //得到商户ID
                var shopID = arr[2];
                //得到城市ID
                var cityID = arr[1];
                //得到商户经纬度
                var lat = arr[4];
                var lng = arr[5];
                //得到此商户的CATEGORYID
                var category = arr[6];
                //得到商户信息
                var shopMessage = arr[3];
                var message = "";
                //查询的数据的总数
                var count = arr[7];
                var shopLogo = arr[8];
                var shopType = "";

                //如果没有商户图片信息则进行默认图片显示
                if (shopLogo == "" || shopLogo == null) {
                    shopLogo = '/Content/img/home/iniImg.jpg';
                }
                //对商户信息进行字数控制操作
                if (i == 0) {

                    message = shopMessage.substring(0, 68);

                }
                else {
                    message = shopMessage.substring(0, 29);
                }

                //判断商户的经纬度,并用其进行地图中心定位
                //做标志为用的变量

                if (i == 0) {
                    if (lat != 0 && lng != 0 && lat != "" && lng != "") {
                        initMap(lat, lng);
                        opinion = 1;
                    }
                } else if (i == 1 && opinion == 0) {
                    if (lat != 0 && lng != 0 && lat != "" && lng != "") {
                        initMap(lat, lng);
                        opinion = 1;
                    }
                } else if (i == 2 && opinion == 0) {
                    if (lat != 0 && lng != 0 && lat != "" && lng != "") {
                        initMap(lat, lng);
                        opinion = 1;
                    }
                } else if (i == 3 && opinion == 0) {
                    if (lat != 0 && lng != 0 && lat != "" && lng != "") {
                        initMap(lat, lng);
                        opinion = 1;
                    }
                } else if (i == 4 && opinion == 0) {
                    if (lat != 0 && lng != 0 && lat != "" && lng != "") {
                        initMap(lat, lng);
                        opinion = 1;
                    }
                } else {
                    if (opinion == '0') {
                        initMap(cityMarkInitLat, cityMarkInitLng);
                    }
                }

                var marker = "";
                if (lat != 0 && lng != 0) {

                    //对各个经纬度进行比对
                    //第一步,得到第一个商户的经纬度
                    if (i == '0') {

                        shopLat1 = lat;
                        shopLng1 = lng;
                        $("#lb_search" + '1').html('标签:A');
                        //当得到第一个商户的经纬度的时候传入INDEX为0,这样来写掉对MARKER的控制
                        marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '0');


                    }
                    //进行第二个商户比对
                    if (i == '1') {

                        shopLat2 = lat;
                        shopLng2 = lng;

                        //在得到第二个商户的经纬度的时候对经纬度进行对比
                        if ((shopLat1 == shopLat2) && (shopLng1 == shopLng2)) {
                            //如果经纬度相同就对其的标签进行赋值
                            $("#lb_search" + '2').html($("#lb_search" + '1').html);
                            //document.getElementById(initTabName + '2').innerHTML = document.getElementById(initTabName + '1').innerHTML;
                            //如果经纬度相同就对其的MARKER进行控制

                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '0');
                        } else {
                            //给标签重新赋值
                            $("#lb_search" + '2').html('标签:B');
                            //document.getElementById(initTabName + '2').innerHTML = ;
                            //如果经纬度不相同就对其的MARKER进行正常的显示

                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '1');
                        }
                    }
                    //进行第三个商户比对
                    if (i == '2') {

                        shopLat3 = lat;
                        shopLng3 = lng;
                        //如果第三个商户的经纬度不和第二个一样,就把第三个商户的经纬度和第一个商户做对比
                        if ((shopLat1 == shopLat3) && (shopLng1 == shopLng3)) {
                            //如果第三个商户的经纬度和第一个相同,则把第三个商户的标签和第一个商户的标签一样
                            //document.getElementById(initTabName + '3').innerHTML = document.getElementById(initTabName + '1').innerHTML;
                            $("#lb_search" + '3').html($("#lb_search" + '1').html);
                            //控制第三个商户的MARKER显示和第一个商户的MARKER一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '0');
                        }
                        //在得到第三个商户的经纬度的时候把它与第二个商户的经纬度进行对比
                        if ((shopLat2 == shopLat3) && (shopLng2 == shopLng3) && (shopLat1 != shopLat3) && (shopLng1 != shopLng3)) {
                            //如果经纬度相同就对其标签进行赋值
                            $("#lb_search" + '3').html($("#lb_search" + '2').html);
                            //document.getElementById(initTabName + '3').innerHTML = document.getElementById(initTabName + '2').innerHTML;
                            //如果第三个商户的经纬度和第二个商户相同,控制它的MARKER显示和第二个商户一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '1');

                        }
                        //如果它与前两个经纬度都不相同就正常生成
                        if ((shopLat2 != shopLat3) && (shopLng2 != shopLng3) && (shopLat1 != shopLat3) && (shopLng1 != shopLng3)) {
                            //给标签重新赋值
                            $("#lb_search" + '3').html('标签:C');
                            //document.getElementById(initTabName + '3').innerHTML = '标签:C';
                            //如果不和前面的商户警卫一样就进行正常的MARKER显示
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '2');
                        }
                    }
                    //进行第四个商户比对
                    if (i == '3') {

                        shopLat4 = lat;
                        shopLng4 = lng;

                        //在得到第四个商户的经纬度的时候把它与第一个商户的经纬度进行对比
                        if ((shopLat1 == shopLat4) && (shopLng1 == shopLng4)) {
                            //把第一个商户的标签赋给与它经纬度相同的第四个商户
                            $("#lb_search" + '4').html($("#lb_search" + '1').html);
                            //document.getElementById(initTabName + '4').innerHTML = document.getElementById(initTabName + '1').innerHTML;
                            //控制第四个商户的MARKER显示和第一个相同
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '0');
                            //如果第四个商户与第一个商户经纬度不一样,就让它与第二个商户对比
                        }
                        if ((shopLat2 == shopLat4) && (shopLng2 == shopLng4) && (shopLat1 != shopLat4) && (shopLng1 != shopLng4)) {
                            //把第二个商户的标签赋给第4个商户
                            $("#lb_search" + '4').html($("#lb_search" + '2').html);
                            //document.getElementById(initTabName + '4').innerHTML = document.getElementById(initTabName + '2').innerHTML;
                            //控制第四个商户的MARKER显示和第二个一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '1');
                            //如果第四个商户的经纬度和前面二个都不一样,则和第三个做比对
                        }
                        if ((shopLat3 == shopLat4) && (shopLng3 == shopLng4) && (shopLat2 != shopLat4) && (shopLng2 != shopLng4) && (shopLat1 != shopLat4) && (shopLng1 != shopLng4)) {
                            //把第三个商户的标签赋给第四个商户
                            $("#lb_search" + '4').html($("#lb_search" + '3').html);
                            //document.getElementById(initTabName + '4').innerHTML = document.getElementById(initTabName + '3').innerHTML;
                            //控制第四个商户的MARKER显示和第三个一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '2');
                        }
                        if ((shopLat1 != shopLat4) && (shopLng1 != shopLng4) && (shopLat2 != shopLat4) && (shopLng2 != shopLng4) && (shopLat3 != shopLat4) && (shopLng3 != shopLng4)) {
                            //给标签重新赋值
                            $("#lb_search" + '4').html('标签:D');
                            //document.getElementById(initTabName + '4').innerHTML = '标签:D';
                            //如果都不相同就正常显示MARKER
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '3');
                        }
                    }
                    //进行第五个商户比对
                    if (i == '4') {
                        shopLat5 = lat;
                        shopLng5 = lng;

                        //对比第五个商户是否和第一个商户有一样的经纬度
                        if ((shopLat1 == shopLat5) && (shopLng1 == shopLng5)) {
                            //如果第五个商户的经纬度和第一个一样,就把第五个商户的标签设置的和第一个标签一样
                            $("#lb_search" + '5').html($("#lb_search" + '1').html);
                            //document.getElementById(initTabName + '5').innerHTML = document.getElementById(initTabName + '1').innerHTML;
                            //控制第五个商户的MARKER显示和第一个商户一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '0');
                            //如果第五个商户和第一个商户经纬度不一样,则和第二个商户对比
                        }
                        if ((shopLat2 == shopLat5) && (shopLng2 == shopLng5) && (shopLat1 != shopLat5) && (shopLng1 != shopLng5)) {
                            //如果第五个商户和第二个商户一样,则第五个商户的标签就和第二个一样
                            $("#lb_search" + '5').html($("#lb_search" + '2').html);
                            //document.getElementById(initTabName + '5').innerHTML = document.getElementById(initTabName + '2').innerHTML;
                            //控制第无个商户的MARKER显示和第二个商户一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '1');
                            //如果第五个商户和前两个商户经纬度都不一样,则和第三个商户的经纬度做比对
                        }
                        if ((shopLat3 == shopLat5) && (shopLng3 == shopLng5) && (shopLat2 != shopLat5) && (shopLng2 != shopLng5) && (shopLat1 != shopLat5) && (shopLng1 != shopLng5)) {
                            //如果第五个商户和第三个商户一致,则让第五个商户的标签显示和第三个商户一样
                            $("#lb_search" + '5').html($("#lb_search" + '3').html);
                            //document.getElementById(initTabName + '5').innerHTML = document.getElementById(initTabName + '3').innerHTML;
                            //控制第五个商户的显示和第三个商户一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '2');
                            //如果第五个商户与前3个商户经纬度都不一样,则让第五个商户和第四个商户做比对
                        }
                        if ((shopLat4 == shopLat5) && (shopLng4 == shopLng5) && (shopLat3 != shopLat5) && (shopLng3 != shopLng5) && (shopLat2 != shopLat5) && (shopLng2 != shopLng5) && (shopLat1 != shopLat5) && (shopLng1 != shopLng5)) {
                            //如果第五个商户和第四个经纬度一样,则把第四个商户的标签赋给第五个商户
                            $("#lb_search" + '5').html($("#lb_search" + '4').html);
                            //document.getElementById(initTabName + '5').innerHTML = document.getElementById(initTabName + '4').innerHTML;
                            //控制第五个商户的MARKER显示和第四个商户一样
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '3');
                        }
                        if ((shopLat1 != shopLat5) && (shopLng1 != shopLng5) && (shopLat2 != shopLat5) && (shopLng2 != shopLng5) && (shopLat3 != shopLat5) && (shopLng3 != shopLng5) && (shopLat4 != shopLat5) && (shopLng4 != shopLng5)) {
                            //给标签重新赋值
                            $("#lb_search" + '5').html('标签:E');
                            //document.getElementById(initTabName + '5').innerHTML = '标签:E';
                            //如果都不一样则正常显示MARKER
                            marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, '4');
                        }
                    }


                    //当经纬度不存在0的时候显示标签

                    // document.getElementById(initTabName + (i + 1)).style["visibility"] = "visible";
                    $(initTabName + (i + 1)).attr("visibility", "visible");
                    // marker = createShop(new GLatLng(lat, lng), shopMessage, shopID, shopLogo, shopType, i);
                    //在图层上显示地图
                    map.addOverlay(marker);
                } else {
                    //当经纬度为0的时候隐藏标签

                    document.getElementById('lb_search' + (i + 1)).style["visibility"] = "hidden";
                }
                //给第一个TAB里的表格中完善它的连接

                //对各个标签进行赋值
                var arrmark = markArr.split('&');

                $("#searchName" + (i + 1)).html(shopName);
                $("#searchMessage" + (i + 1)).html(message + '...');
                $("#search" + (i + 1)).html(shopName + "欢迎您");
                $("#search" + (i + 1)).attr("href", '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng);
                $("#FirstSearch" + (i + 1)).attr("href", '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng);
                $("#searchImg" + (i + 1)).attr("src", shopLogo);
                $("#searchParticularMessage" + (i + 1)).html('>>>>>>详细信息');
                //document.getElementById("searchMessage" + (i + 1)).innerText = message + '...';
                //document.getElementById("search" + (i + 1)).title = shopName + "欢迎您";
                //document.getElementById("search" + (i + 1)).href = '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng;
                //document.getElementById("FirstSearch" + (i + 1)).href = '/City/Trademark/' + shopID + '?CityID=' + cityID + '&CategoryID=' + category + '&Lat=' + lat + '&Lng=' + lng;
                //document.getElementById("searchImg" + (i + 1)).src = shopLogoUrl;
                //document.getElementById("searchParticularMessage" + (i + 1)).innerText = '>>>>>>详细信息';


                //alert('test');
                document.getElementById("searchMessage" + (i + 1)).style["visibility"] = "visible";
                document.getElementById("lb_search" + (i + 1)).style["visibility"] = "visible";
                document.getElementById("search" + (i + 1)).style["visibility"] = "visible";
                document.getElementById("FirstSearch" + (i + 1)).style["visibility"] = "visible";
                document.getElementById("searchImg" + (i + 1)).style["visibility"] = "visible";

                document.getElementById("lb_quarter" + (i + 1)).style["visibility"] = "visible";
                // document.getElementById("searchName" + (i + 1)).style["visibility"] = "visible";
                $("#searchName" + (i + 1)).attr("visibility", "visible");
                document.getElementById("searchParticularMessage" + (i + 1)).style["visibility"] = "visible";

                for (var t = 0; t < 5; t++) {

                    document.getElementById("index" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("shopName" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("messageShop" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("Shop" + (t + 1)).style["visibility"] = "hidden";

                    document.getElementById("firstShop" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("shopLogoImg" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("ParticularMessage" + (t + 1)).style["visibility"] = "hidden";

                    //tableName = 'shop_tb';



                    //根据不同的CATEGORYID来对不同的标签进行显示

                    document.getElementById("lb_junketing" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("junketingName" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("junketingMessage" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("junketing" + (t + 1)).style["visibility"] = "hidden";

                    document.getElementById("firstJunketing" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("junketingImg" + (t + 1)).style["visibility"] = "hidden";

                    document.getElementById("junketingParticularMessage" + (t + 1)).style["visibility"] = "hidden";

                    // tableName = 'pageNum_tb';



                    //根据不同的CATEGORYID来对不同的标签进行显示

                    document.getElementById("lb_dietetic" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("dieteticName" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("dieteticMessage" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("dietetic" + (t + 1)).style["visibility"] = "hidden";


                    document.getElementById("dieteticImg" + (t + 1)).style["visibility"] = "hidden";

                    document.getElementById("dieteticParticularMessage" + (t + 1)).style["visibility"] = "hidden";

                    // tableName = 'dietetic_tb';


                    //根据不同的CATEGORYID来对不同的标签进行显示

                    document.getElementById("lb_quarter" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("quarterName" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("quarterParticularMessage" + (t + 1)).style["visibility"] = "hidden";
                    document.getElementById("quarter" + (t + 1)).style["visibility"] = "hidden";

                    document.getElementById("quarterImg" + (t + 1)).style["visibility"] = "hidden";

                    document.getElementById("quarterParticularMessage" + (t + 1)).style["visibility"] = "hidden";

                    // tableName = 'quarter_tb';
                }

            }



            //如果查询出的数据不足五条信息的显示
            if (fornum != 5) {

                //根据具体有多少条记录来记性计算
                var sumNumi = 5 - fornum;
                //根据循环来对各个标签进行操作
                for (var p = fornum; p < 5; p++) {
                    //alert(fornum);
                    document.getElementById("searchMessage" + (p + 1)).style["visibility"] = "hidden";
                    document.getElementById("lb_search" + (p + 1)).style["visibility"] = "hidden";
                    document.getElementById("search" + (p + 1)).style["visibility"] = "hidden";
                    document.getElementById("FirstSearch" + (p + 1)).style["visibility"] = "hidden";
                    document.getElementById("searchImg" + (p + 1)).style["visibility"] = "hidden";

                    document.getElementById("lb_quarter" + (p + 1)).style["visibility"] = "hidden";
                    //document.getElementById("searchName" + (p + 1)).style["visibility"] = "hidden";
                    $("#searchName" + (i + 1)).attr("visibility", "hidden");
                    document.getElementById("searchParticularMessage" + (p + 1)).style["visibility"] = "hidden";

                }
            } //IF结束






            if (document.getElementById("hidden_CitySearch").value != "1") {
                //进行此TABLE的分页显示
                //alert(count);
                getSearchPageNum(count, 'search_tb');

            }
            //进行此TABLE商户的MARKER显示
            //getCityMarker();
            //对其他标签的显示操作
            document.getElementById("searchLinks").style["visibility"] = "visible";
            document.getElementById("hiddenLable3").style["visibility"] = "hidden";

            document.getElementById("hidden_CitySearch").innerText = "1";
            


        }

        document.getElementById('container-2').style["visibility"] = "visible";

        document.getElementById('container-1').style["visibility"] = "hidden";

        for (var t = 0; t < 5; t++) {

            document.getElementById("index" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("shopName" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("messageShop" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("Shop" + (t + 1)).style["visibility"] = "hidden";

            document.getElementById("firstShop" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("shopLogoImg" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("ParticularMessage" + (t + 1)).style["visibility"] = "hidden";

            //tableName = 'shop_tb';



            //根据不同的CATEGORYID来对不同的标签进行显示

            document.getElementById("lb_junketing" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("junketingName" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("junketingMessage" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("junketing" + (t + 1)).style["visibility"] = "hidden";

            document.getElementById("firstJunketing" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("junketingImg" + (t + 1)).style["visibility"] = "hidden";

            document.getElementById("junketingParticularMessage" + (t + 1)).style["visibility"] = "hidden";

            // tableName = 'pageNum_tb';



            //根据不同的CATEGORYID来对不同的标签进行显示

            document.getElementById("lb_dietetic" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("dieteticName" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("dieteticMessage" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("dietetic" + (t + 1)).style["visibility"] = "hidden";


            document.getElementById("dieteticImg" + (t + 1)).style["visibility"] = "hidden";

            document.getElementById("dieteticParticularMessage" + (t + 1)).style["visibility"] = "hidden";

            // tableName = 'dietetic_tb';


            //根据不同的CATEGORYID来对不同的标签进行显示

            document.getElementById("lb_quarter" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("quarterName" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("quarterParticularMessage" + (t + 1)).style["visibility"] = "hidden";
            document.getElementById("quarter" + (t + 1)).style["visibility"] = "hidden";

            document.getElementById("quarterImg" + (t + 1)).style["visibility"] = "hidden";

            document.getElementById("quarterParticularMessage" + (t + 1)).style["visibility"] = "hidden";

            // tableName = 'quarter_tb';
        }

    })
}
//点击搜索按钮查询的事件
function Serach() {
    document.getElementById("testTrademarkSearch").value == 'testNO';
    //通过对URL的分割来得到具体值
    var locationUrl = window.location.href;
    var CityID = locationUrl.split('/');
    var ID = CityID[CityID.length - 1];
    if (ID.split('#').length > 1) {
        var s = ID.split('#');
        ID = s[0];
    }
    //得到用户输入的关键字
    var searchString = document.getElementById("search").value;

    if (document.getElementById('TrademarkSearchString').value == "" || document.getElementById('TrademarkSearchString').value == null) {
        var scheck1 = 100;

    } else {
        searchString = document.getElementById('TrademarkSearchString').value;
    }
    var param = "";

    if (searchString != "" || searchString != null) {

        var categoryID = '0';

        param = '/City/searchButton/' + ID + "," + categoryID + "," + searchString;
        //通过JSON查出相应的数据
        $.getJSON(param, { t: new Date() }, function(j) {
            var value = j[0];
            if (value != null || value != "" || value != " ") {

                //如果查询后有数据则调用此方法
                var value1 = value + "|" + "1";
                WriteSerachTable(value1);

            } else {
                //如果查询出无数据此为默认显示信息

                document.getElementById("searchLinks").style["visibility"] = "hidden";
                document.getElementById("hiddenLable3").innerText = "暂无任何信息";
                document.getElementById('container-2').style["visibility"] = "visible";

                document.getElementById('Menu005').style['background'] = 'url(../../Content/img/jquery/tab.gif)';

                document.getElementById('container-1').style["visibility"] = "hidden";
                document.getElementById("searchLinks").style["visibility"] = "hidden";
            }
        })
    } else {
        //alert('testSearch2');
        //无任何信息时候的默认信息显示
        document.getElementById("searchLinks").style["visibility"] = "hidden";
        document.getElementById("hiddenLable3").innerText = "暂无任何信息";
        document.getElementById('container-2').style["visibility"] = "visible";
        //document.getElementById('Menu004').style['background'] = 'url(../../Content/img/jquery/tab.gif)';
        document.getElementById('Menu005').style['background'] = 'url(../../Content/img/jquery/tab.gif)';
        //document.getElementById('Menu006').style['background'] = 'url(../../Content/img/jquery/tab.gif)';
        document.getElementById('container-1').style["visibility"] = "hidden";
        document.getElementById("searchLinks").style["visibility"] = "hidden";

    }



}
//查询TAB下的TABLE的页码显示城市
function getSearchPageNum(count, tableName) {
    //得到一共要分多少页
    //清空已经有的页码
    var tabRows = document.getElementById(tableName).rows.length;

    var tb = document.getElementById(tableName);
    if (tabRows != '0') {
        tb.deleteRow(0);
    }
    //TABLE动态生成的代码
    tr1 = document.getElementById(tableName).insertRow();

    var s = "";
    //显示页码的判断
    if (count % 5 == 0) {
        s = parseInt(count / 5) ;
    } else {
        s = count / 5;
    }
    //通过FOR循环来对页码的岩石
    
    for (var j = 0; j < s; j++) {
        var td1 = tr1.insertCell();
        td1.width = "20px";

        td1.innerHTML = "<a href='#' onclick='searchNumTest(" + (j + 1) + ");' id='pageUrl'" + (j + 1) + " class='link'>" + (j + 1) + "</a>";
    }
}


//来得到城市的初始化经纬度
function getCityInitLatLng(cityID) {
    var arrInitCityLng = "";
    //alert(cityID);
    var param = '/City/getCityInitLatLng/' + cityID;
    //通过JSON来得到具体城市的初始化经纬度
    $.getJSON(param, { t: new Date() }, function(j) {
        var value = j[0];

        arrInitCityLng = value.split(',');
        initlat = arrInitCityLng[0];
        initlng = arrInitCityLng[1];
        //alert(initlat + ',' + initlng + 'getCityInitLatLng');
        initMap(initlat, initlng);
    })
}

//用于纪录用户点击的页码数然后调用方法
function searchNumTest(searchNum) {
    var resultCoun = "";
    var searchID = "";
    if (document.getElementById("serachID").value == "" || document.getElementById("serachID").value == null) {
        var g = 10;
    } else {
        searchID = document.getElementById("serachID").value;
    }
    if (document.getElementById("resultCount").value == "" || document.getElementById("resultCount").value == null) {
        var gCount = 10;
    } else {
        resultCoun = document.getElementById("resultCount").value;
    }
    var testWriteTable = searchID + "|" + resultCoun + "|" + searchNum;
    WriteSerachTable(testWriteTable);
}


function getOtherTab() {

    alert(document.getElementById("test_BT").innerHTML);

    $('#a_bo1').click(function() {
        alert('此栏正在建设中');
    })

    $('#a_bo2').click(function() {
        alert('此栏正在建设中');
    })

    $('#a_bo3').click(function() {
        alert('此栏正在建设中');
    })

    $('#a_bo4').click(function() {
        alert('此栏正在建设中');
    })

}

function tgo() {
   // $("#test_BT").html('yes');
    document.getElementById("test_BT").innerHTML = 'yes';
}



